package com.daoliuhe.scaffold.tools;

import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

public class Config {
	public static final String JDBC_DRIVER_CLASS;
	public static final String JDBC_URL;
	public static final String JDBC_USER;
	public static final String JDBC_PASSWORD;
	public static final String JDBC_MINI_POOL_SIZE;
	public static final String JDBC_MAX_POOL_SIZE;
	public static final String JDBC_INITIAL_POOL_SIZE;
	public static final String JDBC_MAX_IDLE_TIME;
	public static final String JDBC_ACQUIRE_INCREMENT;
	public static final String JDBC_AUTO_COMMIT_ON_CLOSE;
	public static final String JDBC_ACQUIRE_RETRY_ATTEMPTS;
	public static final String JDBC_ACQUIRE_RETRY_DELAY;
	public static final String JDBC_TEST_CONNECTION_ON_CHECKIN;
	public static final String JDBC_IDLE_CONNECTION_TEST_PERIOD;
	public static final String JDBC_CHECKOUT_TIMEOUT;
	public static final String JDBC_TEST_CONNECTION_ON_CHECKOUT;
	public static final String JDBC_PREFERRED_TEST_QUERY;

	public static final String REDIS_HOST;
	public static final String REDIS_PORT;
	public static final String REDIS_TIMEOUT;
	public static final String REDIS_AUTH;

	public static final String MAIL_SMTP_SERVER;
	public static final String MAIL_FROM_EMAIL;
	public static final String MAIL_ADMIN_MAILS;
	public static final String MAIL_USERNAME;
	public static final String MAIL_PASSWORD;

	public static final int COOKIE_MAXAGE;

	public static final String LDAP_ROOT_DN;
	public static final String LDAP_TEMPLATE;
	public static final String LDAP_URL;

	static {
		ResourceBundle rb = PropertyResourceBundle.getBundle("config");
		
    	JDBC_DRIVER_CLASS = rb.getString("jdbc.driverClass");
		JDBC_URL = rb.getString("jdbc.url");
    	JDBC_USER = rb.getString("jdbc.user");
    	JDBC_PASSWORD = rb.getString("jdbc.password");
    	JDBC_MINI_POOL_SIZE = rb.getString("jdbc.miniPoolSize");
    	JDBC_MAX_POOL_SIZE = rb.getString("jdbc.maxPoolSize");
    	JDBC_INITIAL_POOL_SIZE = rb.getString("jdbc.initialPoolSize");
    	JDBC_MAX_IDLE_TIME = rb.getString("jdbc.maxIdleTime");
    	JDBC_ACQUIRE_INCREMENT = rb.getString("jdbc.acquireIncrement");
    	JDBC_AUTO_COMMIT_ON_CLOSE = rb.getString("jdbc.autoCommitOnClose");
    	JDBC_ACQUIRE_RETRY_ATTEMPTS = rb.getString("jdbc.acquireRetryAttempts");
    	JDBC_ACQUIRE_RETRY_DELAY = rb.getString("jdbc.acquireRetryDelay");
    	JDBC_TEST_CONNECTION_ON_CHECKIN = rb.getString("jdbc.testConnectionOnCheckin");
    	JDBC_IDLE_CONNECTION_TEST_PERIOD = rb.getString("jdbc.idleConnectionTestPeriod");
    	JDBC_CHECKOUT_TIMEOUT = rb.getString("jdbc.checkoutTimeout");
    	JDBC_TEST_CONNECTION_ON_CHECKOUT = rb.getString("jdbc.testConnectionOnCheckout");
    	JDBC_PREFERRED_TEST_QUERY = rb.getString("jdbc.preferredTestQuery");

    	REDIS_HOST = rb.getString("redis.host");
    	REDIS_PORT = rb.getString("redis.port");
    	REDIS_TIMEOUT = rb.getString("redis.timeout");
    	REDIS_AUTH = rb.getString("redis.auth");

    	MAIL_SMTP_SERVER = rb.getString("mail.smtpServer");
    	MAIL_FROM_EMAIL = rb.getString("mail.fromEmail");
    	MAIL_ADMIN_MAILS = rb.getString("mail.adminMails");
    	MAIL_USERNAME = rb.getString("mail.username");
    	MAIL_PASSWORD = rb.getString("mail.password");

		COOKIE_MAXAGE = Integer.parseInt(rb.getString("cookie.maxAge"));

		LDAP_ROOT_DN = rb.getString("ldap.rootDN");
		LDAP_TEMPLATE = rb.getString("ldap.template");
		LDAP_URL = rb.getString("ldap.url");
	}
	
}
